<template>
  <div class="container">
    <div class="identity-panel">
      <div class="eyes-header-background"></div>
      <div class="loader eyes-header"></div>
      <div class="title" @click="showHomePage">Home.ai</div>
      <div class="drop-down-menu">
        <a-dropdown>
          <a class="ant-dropdown-link" @click.prevent>
            主页
            <DownOutlined />
          </a>
          <template #overlay>
            <a-menu class="Menu-Style">
              <a-menu-item>
                <a class="menu-font" style="color: #dddddd" @click="router.push('/Home_Page/Personal_homepage')">个人主页</a>
              </a-menu-item>
              <a-menu-item>
                <a class="menu-font" style="color: #dddddd" @click="router.push('/Home_Page/Wallet_recharge')">钱包充值</a>
              </a-menu-item>
              <a-menu-item>
                <a class="menu-font" style="color: #dddddd">回到主页</a>
              </a-menu-item>
              <a-menu-item>
                <a class="menu-font" style="color: #dddddd">退出登录</a>
              </a-menu-item>
            </a-menu>
          </template>
        </a-dropdown>
      </div>
      <div class="Introduction-functions" v-show="!isSubRoute">
        <!-- 快捷接入区域 -->
        <div class="quick-access">
          <div class="access-card">
            <h3>定制旅游计划，让您的旅途变得便捷</h3>
            <p>接入DeepSeek-R1模型，一键生成旅游规划，多种模板可以选择</p>
            <div class="button-group">
              <button>API接入</button>
              <button>立即体验</button>
              <button>更多加速方案</button>
            </div>
          </div>
          <div class="access-card">
            <h3>专属模型应用(DeepSeek-R1 联网搜索版)</h3>
            <p>打造专属应用场景，定制模型与用户体验</p>
            <div class="button-group">
              <button>快速创建</button>
              <button>立即体验</button>
              <button>更多示例应用</button>
            </div>
          </div>
        </div>

        <!-- 功能介绍区域 -->
        <div class="function-showcase">
          <h3>功能介绍</h3>
          <div class="function-cards">
            <button class="nav-button nav-button-left" @click="showPreviousItems">
              <span class="arrow">←</span>
            </button>
            <div class="cards-container" :style="{transform: `translateX(-${currentIndex * 100}%)`}">
              <div v-for="(item, index) in functionItems" :key="index" class="function-card">
                <h4>{{ item.title }}</h4>
                <p>{{ item.desc }}</p>
              </div>
            </div>
            <button class="nav-button nav-button-right" @click="showNextItems">
              <span class="arrow">→</span>
            </button>
          </div>
        </div>
        <div class="model-applications">
          <h2 class="section-title">多样的大模型应用场景</h2>

          <div class="tab-container">
            <div class="tabs">
              <div
                v-for="(tab, index) in applicationTabs"
                :key="index"
                class="tab"
                :class="{ 'active-tab': activeTabIndex === index }"
                @click="activeTabIndex = index"
              >
                {{ tab.name }}
              </div>
            </div>

            <div class="tab-content">
              <div class="content-left">
                <div v-for="(point, index) in applicationTabs[activeTabIndex].points" :key="index" class="feature-point">
                  <span class="check-icon">✓</span>
                  <span>{{ point }}</span>
                </div>

                <div class="related-solutions">
                  <h4>相关产品与解决方案</h4>
                  <div class="solution-logos">
                    <div v-for="(solution, index) in applicationTabs[activeTabIndex].solutions" :key="index" class="solution-logo">
                      {{ solution }}
                    </div>
                  </div>
                </div>

                <div class="action-buttons">
                  <button class="action-btn experience-btn">立即体验</button>
                  <button class="action-btn consult-btn">在线咨询</button>
                </div>
              </div>

              <div class="content-right">
                <div class="demo-image">
                  <img :src="applicationTabs[activeTabIndex].image" alt="应用场景演示" />
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <router-view />
      <div class="top-function top-function1">
        <ul>
          <li @click="goToTravelPlan">智旅计划</li>
          <li>功能2</li>
        </ul>
      </div>
      <div class="top-function top-function2 ">
        <ul>
          <li>功能3</li>
          <li>云商城</li>
        </ul>
      </div>

      <!--      <hr style="margin-top: 4.5%; border: none; border-top: 1px solid #a36afe;">-->
    </div>
  </div>
</template>
<script setup>
import {ref, onMounted, watch} from 'vue'
import router from "../router";
import {useRoute} from 'vue-router';

const currentIndex = ref(0);
const route = useRoute();
const isSubRoute = ref(false);

// 监听路由变化
watch(() => route.path, (newPath) => {
  // 检查是否是子路由
  isSubRoute.value = newPath !== '/Home_Page';
}, {immediate: true});

// 显示首页内容并导航到首页
const showHomePage = () => {
  router.push('/Home_Page');
  isSubRoute.value = false;
};

// 导航到智旅计划页面
const goToTravelPlan = () => {
  router.push('/Home_Page/Intelligent_travel_plan');
  isSubRoute.value = true;
};

// 初始化时检查当前路由
onMounted(() => {
  isSubRoute.value = route.path !== '/Home_Page';
});

const functionItems = [
  { title: '智能广场', desc: '了解AI最新动态', link: '#' },
  { title: '体验中心', desc: '操作示范与体验', link: '#' },
  { title: '模型推理', desc: '定制模型与调用', link: '#' },
  { title: '系统管理', desc: '系统配置与升级', link: '#' },
  { title: '功能五', desc: '描述文本', link: '#' },
  { title: '功能六', desc: '描述文本', link: '#' },
  { title: '功能七', desc: '描述文本', link: '#' },
  { title: '功能八', desc: '描述文本', link: '#' }
];

// 新增标签页数据
const activeTabIndex = ref(0);

const applicationTabs = [
  {
    name: '智能座舱',
    points: [
      '应用场景：火车/飞机/轮船/汽车等交通工具，行业研究，安全RAG和对话机器人',
      'POI推荐与行程规划：从用户兴趣和旅行目的地POI信息整合，提供个性化推荐',
      '人机对话：以人为本设计，界面简洁，智能理解用户问题并给出合适的回答，提供精确的导航和行程帮助'
    ],
    solutions: ['百度地图', 'HugeGPT', '火山引擎'],
    image: '/src/assets/3626141.jpg' // 修改为相对路径
  },
  {
    name: '智能终端',
    points: [
      '智能手机和平板电脑应用场景',
      '语音助手和智能推荐系统',
      '个性化用户体验和内容定制'
    ],
    solutions: ['智能助手', '语音识别', '内容推荐'],
    image: '/src/assets/3626141.jpg' // 修改为相对路径
  },
  {
    name: '在线教育',
    points: [
      '智能辅导和个性化学习路径',
      '实时答疑和知识点解析',
      '学习进度跟踪和成绩分析'
    ],
    solutions: ['智能辅导', '知识图谱', '学习分析'],
    image: '/src/assets/3626141.jpg' // 修改为相对路径
  },
  {
    name: '社交娱乐',
    points: [
      '智能内容推荐和社交互动',
      '虚拟形象和场景生成',
      '情感分析和用户匹配'
    ],
    solutions: ['内容推荐', '虚拟形象', '社交分析'],
    image: '/src/assets/3626141.jpg' // 修改为相对路径
  },
  {
    name: '智能客服',
    points: [
      '24小时自动客服响应',
      '多语言支持和情感理解',
      '问题分类和精准转接'
    ],
    solutions: ['智能对话', '情感分析', '问题分类'],
    image: '/src/assets/3626141.jpg' // 修改为相对路径
  },
  {
    name: '营销提效',
    points: [
      '智能营销内容生成',
      '用户行为分析和精准投放',
      '营销效果实时监测'
    ],
    solutions: ['内容生成', '用户分析', '效果监测'],
    image: '/src/assets/3626141.jpg' // 修改为相对路径
  },
  {
    name: '消费零售',
    points: [
      '智能购物推荐系统',
      '虚拟试衣和产品展示',
      '消费者行为分析'
    ],
    solutions: ['购物助手', '虚拟展示', '消费分析'],
    image: '/src/assets/3626141.jpg' // 修改为相对路径
  }
];

const showNextItems = () => {
  currentIndex.value = currentIndex.value === 0 ? 1 : 0;
};

const showPreviousItems = () => {
  currentIndex.value = currentIndex.value === 1 ? 0 : 1;
};
</script>
<style scoped>
*{
  margin: 0;
  padding: 0;
}
.container{
  background-color: #0d0d12; /* 你想要的背景颜色 */
  min-height: 160vh; /* 让整个页面都有颜色 */
}
.identity-panel{

}
.loader {
  height: 40px;
  aspect-ratio: 2;
  background:
      radial-gradient(farthest-side,#000 15%,#0000 18%)
      0 0/50% 100%,

      radial-gradient(50% 100% at 50% 160%,#fff 95%,#0000)
      0 0   /50% 50%,

      radial-gradient(50% 100% at 50% -60%,#fff 95%,#0000)
      0 100%/50% 50%;

  background-repeat: repeat-x;
  animation: animate-bgpos 1.5s infinite linear;
}
@keyframes animate-bgpos {
  0%, 15% {background-position:0   0,0 0,0 100%}
  20%, 40% {background-position:5px 0,0 0,0 100%}
  45%, 55% {background-position:0   0,0 0,0 100%}
  60%, 80%{background-position:-5px 0,0 0,0 100%}
  85%, 100% {background-position:0   0,0 0,0 100%}
}
.title {
  cursor: pointer;
  font-size: 20px;
  position: absolute;
  left: 2%;
  top: 7%;
  background: linear-gradient(45deg, #ff00ff, #7700ff, #00ffff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: bold;
  text-shadow: 0 0 5px rgba(255, 0, 255, 0.8),
  0 0 10px rgba(119, 0, 255, 0.8),
  0 0 15px rgba(0, 255, 255, 0.8);
}
.top-function1 {
  position: absolute;
  top: 6%;
  left: 26.5%;
}
.top-function2 {
  position: absolute;
  top: 6%;
  left: 52%;
}
.top-function ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex; /* 让子元素在同一行显示 */
  gap: 72px; /* 设置元素之间的间距 */
}

.top-function li {
  font-size: 18px;
  padding: 10px 30px;
  border-radius: 8px; /* 圆角，让按钮更有科技感 */
  text-align: center;
  font-weight: bold;
  text-transform: uppercase; /* 大写字母，增强未来感 */
  cursor: pointer;
  background: linear-gradient(45deg, #aa00aa, #5500aa, #008888); /* 调整颜色，使其更暗 */
  color: white;
  box-shadow: 0 0 5px rgba(85, 0, 170, 0.6),
  0 0 10px rgba(0, 136, 136, 0.6); /* 减弱光效强度 */
  transition: all 0.3s ease-in-out;
}

/* 悬停时增加发光效果 */
.top-function li:hover {
  box-shadow: 0 0 8px rgba(170, 0, 170, 0.8),
  0 0 15px rgba(85, 0, 170, 0.8),
  0 0 20px rgba(0, 136, 136, 0.8); /* 适当降低亮度 */
  transform: scale(1.05); /* 悬停时稍微放大，降低夸张感 */
}
.drop-down-menu{
  z-index: 99;
  position: absolute;
  top: 7%;
  left: 90%;
}
.ant-dropdown-link{
  cursor: pointer;
  color: #dddddd;
}
.Menu-Style{
  background-color: #312f3e;
  color: white;
  font-weight: bolder;
}
.menu-font{
  font-size: 16px;
  padding: 5px;
  transition: color 0.3s;
}
.menu-font:hover {
  color: red !important; /* 鼠标悬浮时变红 */
}
.Introduction-functions{
  position: absolute;
  top: 20%;
  left: 10%;
  width: 80%;
  color: #fff;
}
.eyes-header{
  position: relative;
  left: 45%;
  top: 50px;
  background-color: #373442;
  border-radius: 20px;
}
.eyes-header-background{
  position: absolute;
  top: 4%;
  left: 26%;
  width: 45%;
  height: 8%;
  background-color: #211e2d;
  border-radius: 25px;
}
.quick-access {
  display: flex;
  gap: 20px;
  margin-bottom: 40px;
}

.access-card {
  flex: 1;
  background: rgba(49, 47, 62, 0.8);
  padding: 20px;
  border-radius: 12px;
  border: 1px solid rgba(170, 0, 170, 0.3);
}

.access-card h3 {
  color: #fff;
  margin-bottom: 10px;
}

.access-card p {
  color: #aaa;
  margin-bottom: 20px;
}

.button-group {
  display: flex;
  gap: 10px;
}

.button-group button {
  padding: 8px 15px;
  border-radius: 6px;
  background: linear-gradient(45deg, #aa00aa, #5500aa);
  color: white;
  border: none;
  cursor: pointer;
  transition: all 0.3s;
}

.button-group button:hover {
  box-shadow: 0 0 10px rgba(170, 0, 170, 0.8);
}

.function-showcase {
  margin-top: 20px;
}

.function-cards {
  position: relative;
  overflow: hidden;
  margin-top: 20px;
  padding-bottom: 50px; /* 添加底部padding为箭头按钮留出空间 */
}

.cards-container {
  display: flex;
  transition: transform 0.5s ease;

}

.function-card {
  flex: 0 0 25%;
  padding: 20px;
  background: rgba(49, 47, 62, 0.8);
  border-radius: 12px;
  margin: 10px;
  border: 1px solid rgba(170, 0, 170, 0.3);
  max-width: 20.5%;
  min-height: 220px;

}

.nav-button {
  z-index: 999;
  position: absolute;
  bottom: 10px; /* 修改位置到底部 */
  background: rgba(170, 0, 170, 0.3);
  border: none;
  color: white;
  padding: 10px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  transform: none; /* 移除Y轴的transform */
}

.nav-button:hover {
  background: rgba(170, 0, 170, 0.5);
  box-shadow: 0 0 10px rgba(170, 0, 170, 0.8);
}

.nav-button-left {
  left: 40%; /* 调整左箭头位置 */
}

.nav-button-right {
  right: 40%; /* 调整右箭头位置 */
}

.arrow {
  font-size: 20px;
  display: inline-block;
}
/* 多样的大模型应用场景样式 */
.model-applications {
  margin-top: 50px;
  width: 100%;
}

.section-title {
  text-align: center;
  font-size: 28px;
  font-weight: bold;
  margin-bottom: 30px;
  background: linear-gradient(45deg, #ff00ff, #7700ff, #00ffff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 5px rgba(255, 0, 255, 0.3);
}

.tab-container {
  width: 100%;
}

.tabs {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(170, 0, 170, 0.3);
}

.tab {
  padding: 12px 20px;
  margin: 0 5px;
  cursor: pointer;
  color: #dddddd;
  font-size: 16px;
  position: relative;
  transition: all 0.3s;
}

.tab:hover {
  color: #ffffff;
}

.active-tab {
  color: #ffffff;
  font-weight: bold;
  border-bottom: 3px solid #aa00aa;
}

.tab-content {
  display: flex;
  background: rgba(49, 47, 62, 0.8);
  border-radius: 12px;
  padding: 30px;
  min-height: 400px;
  border: 1px solid rgba(170, 0, 170, 0.3);
}

.content-left {
  flex: 1;
  padding-right: 30px;
}

.content-right {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.feature-point {
  margin-bottom: 15px;
  display: flex;
  align-items: flex-start;
}

.check-icon {
  color: #aa00aa;
  margin-right: 10px;
  font-weight: bold;
}

.related-solutions {
  margin-top: 30px;
}

.related-solutions h4 {
  margin-bottom: 15px;
  font-size: 18px;
  color: #ffffff;
}

.solution-logos {
  display: flex;
  gap: 15px;
  margin-bottom: 30px;
}

.solution-logo {
  background: rgba(33, 30, 45, 0.8);
  padding: 8px 15px;
  border-radius: 20px;
  font-size: 14px;
  color: #dddddd;
}

.action-buttons {
  display: flex;
  gap: 15px;
  margin-top: 20px;
}

.action-btn {
  padding: 10px 25px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  transition: all 0.3s;
}

.experience-btn {
  background: linear-gradient(45deg, #aa00aa, #5500aa);
  color: white;
}

.consult-btn {
  background: transparent;
  border: 1px solid #aa00aa;
  color: #ffffff;
}

.experience-btn:hover, .consult-btn:hover {
  box-shadow: 0 0 10px rgba(170, 0, 170, 0.8);
  transform: translateY(-2px);
}

.demo-image {
  width: 100%;
  height: 300px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 0 20px rgba(170, 0, 170, 0.3);
}

.demo-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s;
}

.demo-image:hover img {
  transform: scale(1.05);
}
</style>